package com.wzl.myviewgroup;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.wzl.myviewgroup.flow.FlowLayout;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        FlowLayout flowLayout = this.findViewById(R.id.flow_layout);

        List<String> data =new ArrayList<>();
        data.add("键盘");
        data.add("显示器");
        data.add("鼠标");
        data.add("ipad");
        data.add("air pod");
        data.add("Android手机");
        data.add("mac pro");
        data.add("mac pro poasodfposdfposdfsdfasdfsdfasdfsdfasdfsdfsdfsdfsdfsdfsdfsfsdfsdfsdfs");
        data.add("耳机");
        data.add("春夏秋冬超帅装");
        data.add("男鞋");
        data.add("女装");
        flowLayout.setTextList(data);
        flowLayout.setOnItemClickListener(new FlowLayout.OnItemClickListener() {
            @Override
            public void onItemClickListener(View v, String text) {
                Log.d("MainActivity", "onItemClickListener: "+text);
            }

        });

    }
}